<?php

/**
 * todo module helper.
 *
 * @package    check
 * @subpackage todo
 * @author     Éric Rogé <eric.roge@ui-studio.fr>
 * @version    SVN: $Id: todoGeneratorHelper.class.php 3 2009-06-19 20:51:19Z Eric.Roge $
 */
class todoGeneratorHelper extends BaseTodoGeneratorHelper
{
  public function linkToTogglePublish($todo)
  {
    if (true === $todo->is_published)
    {
      return '<li class="sf_admin_action_unpublish">'.link_to(
        __('Unpublish', array(), 'sf_admin'),
        'todo_unpublish',
        $todo,
        array(
          'method'  => 'put',
          'confirm' => 'Are you sure?',
        )
      ).'</li>';
    }
    else
    {
      return '<li class="sf_admin_action_publish">'.link_to(
        __('Publish', array(), 'sf_admin'),
        'todo_publish',
        $todo,
        array(
          'method'  => 'put',
          'confirm' => 'Are you sure?',
        )
      ).'</li>';
    }
  }

  public function linkToPreview($object, $params)
  {
    return '<li class="sf_admin_action_save"><input type="submit" value="'.__($params['label'], array(), 'sf_admin').'" name="_preview" /></li>';
  }
}
